#pragma once

#include "sqlite3.h"
#include <functional>
#include <string>
#include <vector>

struct SQLite3Wrapper {
    using queryRes = std::vector<std::vector<std::string>>;

public:
    SQLite3Wrapper(const std::string &dbFile);
    ~SQLite3Wrapper();

    void execute(std::string &query) const;
    queryRes query(std::string &query) const;
    void initializeFromFile(const std::string &sqlFile);

    void queryWithCallback(
        const std::string &query,
        std::function<bool(const std::vector<std::string> &)> callback);

private:
    sqlite3 *db;
    void executeStream(std::ifstream &file);
    bool open(const std::string &dbFile);
    void close();
};